package com.younion.business.impl;

import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.younion.common.exception.BaseException;
import com.younion.dao.UserDAO;
import com.younion.vo.UserVO;

public abstract class BaseService {
    @Autowired
	protected UserDAO userDAO;
	
	public UserVO getCurrectUser(){
		UserVO param = new UserVO(SecurityUtils.getSubject().getPrincipal().toString());
		UserVO user = null;
		try {
			user = getUserDAO().selectByUser(param);
		} catch (BaseException e) {
			return null;
		}
		return user;
	}

	public UserDAO getUserDAO() {
		return userDAO;
	}

	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

}
